import 'package:flutter_test/flutter_test.dart';

void main() {
  group('计数器测试', () {
    test('初始值应该为0', () {
      final counter = Counter();
      expect(counter.value, 0);
    });

    test('递增后值应该为1', () {
      final counter = Counter();
      counter.increment();
      expect(counter.value, 1);
    });

    test('递减后值应该为-1', () {
      final counter = Counter();
      counter.decrement();
      expect(counter.value, -1);
    });

    test('多次递增后值应该正确', () {
      final counter = Counter();
      counter.increment();
      counter.increment();
      counter.increment();
      expect(counter.value, 3);
    });

    test('重置后值应该为0', () {
      final counter = Counter();
      counter.increment();
      counter.increment();
      counter.reset();
      expect(counter.value, 0);
    });
  });
}

/// 简单的计数器类用于测试
/// 这是一个示例类，用于演示Flutter单元测试
class Counter {
  int _value = 0;

  int get value => _value;

  void increment() {
    _value++;
  }

  void decrement() {
    _value--;
  }

  void reset() {
    _value = 0;
  }
}

